package one.stand.controller;

import com.alibaba.fastjson.JSON;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: QIK
 * @CreateDate: 2019/5/14 14:49
 */
@RestController
@RequestMapping("code/template")
public class CodeTemplateController extends BaseController {
    /**
     * 把草稿存为模板
     *
     * @param draftId
     * @return
     */
    @PostMapping("addTotemplate")
    public String addTotemplate(@RequestParam String draftId) {
        return JSON.toJSONString(codeTemplateService.addTotemplate(draftId));
    }

    /**
     * 获取代码草稿
     *
     * @return
     */
    @PostMapping("getTemplateDraftList")
    public String getTemplateDraftList() {
        return JSON.toJSONString(codeTemplateService.getTemplateDraftList());
    }

    /**
     * 获取所有模板
     *
     * @return
     */
    @PostMapping("getTemplateList")
    public String getTemplateList() {
        return JSON.toJSONString(codeTemplateService.getTemplateList());
    }
}
